<?php
namespace app\admin\model;

use think\Model;

class RoleModel extends Model
{
    // 设置当前模型对应的完整数据表名称
    protected $table = 'ant_role';

    // 设置当前模型的数据库连接
    protected $connection = 'db_config';

    public function getInfoByWhere( $where = [], $field="*" )
    {
        $info = $this
            ->where( $where )
            ->field( $field )
            ->find();
        return empty($info) ? [] : $info->toArray();
    }

    public function editInfoById( $id, $data )
    {
        $res = $this->save( $data, [
            'id' => $id
        ] );
        return $res;
    }

}